package demo5;

public class TestDemo {

    public static void walk(IRun runrun){
        runrun.run();
    }

    public static  void fly(IFly flyfly){

        flyfly.fly();
    }

    public static void swim(ISwim swimswim){
        swimswim.swim();
    }

    public static void main(String[] args) {
        Bird bird = new Bird("小鸟",2);
        Dog dog = new Dog("旺财",4);
        Duck duck = new Duck("唐老鸭",5);
        Robot robot = new Robot();

        walk(duck);
        walk(dog);
        walk(robot);
        System.out.println("=======");

        swim(duck);
        swim(dog);
        System.out.println("======");

        fly(bird);
        fly(duck);
    }







    public static void eatFunc(Animal animal){
        animal.eat();
    }

    public static void main1(String[] args) {
        Bird bird = new Bird("小鸟",2);
        Dog dog = new Dog("旺财",4);

        eatFunc(bird);
        eatFunc(dog);
        /*bird.eat();
        dog.eat();*/
    }
}
